﻿Imports System.Configuration
Imports System.Xml
Namespace OpenArchive
    Namespace System
        Namespace Configuration
            Public Class SystemFilesConfigurationCollection
                Inherits ConfigurationElementCollection

                Public Sub New()
                End Sub

                Public Overrides ReadOnly Property CollectionType() As ConfigurationElementCollectionType
                    Get
                        Return ConfigurationElementCollectionType.AddRemoveClearMap
                    End Get
                End Property

                Protected Overloads Overrides Function CreateNewElement() As ConfigurationElement
                    Return New SystemFileConfigElement()
                End Function 'CreateNewElement

                Protected Overloads Overrides Function CreateNewElement(ByVal elementName As String) As ConfigurationElement
                    Return New SystemFileConfigElement(elementName)
                End Function 'CreateNewElement

                Protected Overrides Function GetElementKey(ByVal element As ConfigurationElement) As [Object]
                    Return CType(element, SystemFileConfigElement).Name
                End Function 'GetElementKey

                Public Shadows Property AddElementName() As String
                    Get
                        Return MyBase.AddElementName
                    End Get

                    Set(ByVal value As String)
                        MyBase.AddElementName = value
                    End Set
                End Property

                Public Shadows Property ClearElementName() As String
                    Get
                        Return MyBase.ClearElementName
                    End Get

                    Set(ByVal value As String)
                        MyBase.AddElementName = value
                    End Set
                End Property

                Public Shadows ReadOnly Property RemoveElementName() As String
                    Get
                        Return MyBase.RemoveElementName
                    End Get
                End Property

                Public Shadows ReadOnly Property Count() As Integer
                    Get
                        Return MyBase.Count
                    End Get
                End Property

                Default Public Shadows Property Item(ByVal index As Integer) As SystemFileConfigElement
                    Get
                        Return CType(BaseGet(index), SystemFileConfigElement)
                    End Get

                    Set(ByVal value As SystemFileConfigElement)
                        If Not (BaseGet(index) Is Nothing) Then
                            BaseRemoveAt(index)
                        End If
                        BaseAdd(index, value)
                    End Set
                End Property

                Default Public Shadows ReadOnly Property Item(ByVal Name As String) As SystemFileConfigElement
                    Get
                        Return CType(BaseGet(Name), SystemFileConfigElement)
                    End Get
                End Property

                Public Function IndexOf(ByVal Archive As SystemFileConfigElement) As Integer

                    Return BaseIndexOf(Archive)
                End Function 'IndexOf

                Public Sub Add(ByVal Archive As SystemFileConfigElement)
                    BaseAdd(Archive)
                    ' Add custom code here.
                End Sub 'Add

                Protected Overrides Sub BaseAdd(ByVal element As ConfigurationElement)
                    BaseAdd(element, False)
                    ' Add custom code here.
                End Sub 'BaseAdd

                Public Overloads Sub Remove(ByVal url As SystemFileConfigElement)
                    If BaseIndexOf(url) >= 0 Then
                        BaseRemove(url.Name)
                    End If
                End Sub 'Remove

                Public Sub RemoveAt(ByVal index As Integer)
                    BaseRemoveAt(index)
                End Sub 'RemoveAt

                Public Overloads Sub Remove(ByVal name As String)
                    BaseRemove(name)
                End Sub 'Remove    

                Public Sub Clear()
                    BaseClear()
                End Sub 'Clear ' 
            End Class
        End Namespace
    End Namespace
End Namespace
